package src;

import java.io.File;
import java.io.IOException;

/**
 * Created by dell on 2017/8/7.
 */
public class FileTest {
    public static void main(String[] args) throws IOException {
        File file=new File(".");
        System.out.println(file.getName());
        System.out.println(file.getParent());
        System.out.println(file.getAbsoluteFile());
        System.out.println(file.getAbsoluteFile().getParent());
        File tempFile=File.createTempFile("aaa",".txt",file);
        tempFile.deleteOnExit();
        File newFile=new File(System.currentTimeMillis()+"");
        System.out.println("是否存在："+newFile.exists());
        newFile.createNewFile();
        System.out.println(newFile.mkdir());
        String[] fileList=file.list();
        for (String fileName:fileList){
            System.out.println(fileName);
        }
        File[] root=file.listRoots();
        System.out.println("所有根路径的文件名：");
        for (File a:root){
            System.out.println(a);
        }
    }
}
